var JdWubi = function(phraseArr){
    this.phraseArr = phraseArr;
}

JdWubi.prototype.getMainPhraseBuff = function (isForQQ){
    var pBody = [];
	var order = 0;
	var i = 0;
    var chReg = new RegExp("^([\\u4e00-\\u9fa5]+)$");
    for(var phrase of this.phraseArr){
        var code = phrase[0];
        var alphaIndex = code.charCodeAt(0) - 97;
        if(isForQQ && alphaIndex > 24){break;}
		var sgArr = this.getSingleBuff(phrase[0], !isForQQ ? phrase.slice(1) : phrase.slice(1).filter(item=>chReg.test(item)));
        Array.prototype.push.apply(pBody, sgArr);
    }
    var pHead = [0xff, 0xfe];
	pHead = pHead.concat(pBody);
    return pHead;
}

JdWubi.prototype.getSingleBuff = function (code, terms){
    var arr = [];
    if(terms.length == 0){
        return [];
    }
    Array.prototype.push.apply(arr, PhraseUtil.getStrBuff(code));
	Array.prototype.push.apply(arr, [0x20, 0x00]);
	Array.prototype.push.apply(arr, PhraseUtil.getStrBuff(terms.join(" ")));
    Array.prototype.push.apply(arr, [0x0d, 0x00, 0x0a, 0x00]);
    return arr;
}